package com.zhang.config;



import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;



@Configuration
public class RabbitMQConfig {

    //创建交换机
    @Bean
    public TopicExchange topicExchange(){

        return new TopicExchange("e1");
    }

    //创建队列
    @Bean
    public Queue queue(){

        return new Queue("q1");
    }

    //交换机和队列绑定
    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(topicExchange()).with("*.aaa.#");
    }


}
